package com.sankuai.project.service;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author：YH
 * @Description：
 * @Date:Created in 2022/3/10 22:56
 */
public class MySimpleJob implements SimpleJob {

    private static final Logger LOGGER = LoggerFactory.getLogger(SimpleJob.class);

    @Override
    public void execute(ShardingContext shardingContext) {

        String format = String.format("------Thread ID: %s, 任务总片数: %s, 当前分片项: %s", Thread.currentThread().getId(),
                shardingContext.getShardingTotalCount(), shardingContext.getShardingItem());
        LOGGER.info("数据分片:{}", format);
    }
}
